
from event.event import GameEvent, ExceptionEvent
from event.event_types import EVENT_UPDATE, EXCEPTION
import unittest

class  EventTestCase(unittest.TestCase):

    def test_type(self):
        event = GameEvent(EVENT_UPDATE)
        self.assertEqual(event.type, EVENT_UPDATE, "Event has incorrect type")

    def test_exception(self):
        ex = KeyboardInterrupt()
        game_ex = ExceptionEvent(ex)
        self.assertEqual(game_ex.type, EXCEPTION, "Exception has incorrect type")
        self.assertEqual(game_ex.exception, ex, "Exception has wrong exception stored")
        self.assertEqual(game_ex.handled, False, "Exception should not be handled yet")

if __name__ == '__main__':
    unittest.main()

